{% include 'front/header1.html' %}
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.6&key=4cf311835bbf55ce280047af1fbd7c85&plugin=AMap.CitySearch"></script>
<link rel="stylesheet" href="/resource/front/css/mobile/quill.bubble.css" />
<link rel="stylesheet" href="/resource/front/css/mobile/quill.core.css" />
<link rel="stylesheet" href="/resource/front/css/mobile/quill.snow.css" />
<style type="text/css">
	body {
		/*height: auto;*/
	}
	
	.mui-bar {
		background: #000000 !important;
		color: #fff !important;
		position: relative !important;
	}
	
	.mui-title {
		color: #fff !important;
	}
	
	#top-content img.lazy {
		width: 100%;
	}
	
	table {
		width: 100%;
	}
	
	.mui-bar {
		position: absolute;
	}
	
	.mui-bar .mui-title {
		left: 0;
		right: 0;
	}
	
	.left {
		text-align: left !important;
	}
	
	.right {
		text-align: center !important;
	}
	
	textarea,
	p {
		margin-bottom: 0;
	}
	
	#bottom-content {
		/*padding: 0 19px;*/
		display: flex;
	}
	
	#ly p {
		color: 0.32rem;
		color: #333;
	}
	
	.other {
		/*padding: 0 19px;*/
		width: 100%;
		display: flex;
		flex-flow: row;
		flex-wrap: wrap;
		justify-content: space-between;
	}
	
	.content {
		padding-top: 1.76rem !important;
		position: relative;
	}
	
	input {
		font-size: 0.32rem;
	}
	
	#submit {
		color: #fff;
	}
	
	.get-money {
		width: 7.733333rem;
		height: 608px;
		position: fixed;
		top: 246px;
		z-index: 1001;
		margin: auto;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
	}
	
	.alert-img-box {
		top: 150px;
		width: 100%;
		/*width: 3.293333rem;
		 height: 4.053333rem;*/
		position: relative;
	}
	
	.alert-img-box img {
		width: 95%;
		height: 100%;
		/*margin-left: 10%;*/
		object-fit: cover;
	}
	
	.alert-img-box .p {
		display: flex;
		flex-flow: column;
		justify-content: center;
		position: absolute;
		left: 0;
		top: 10px;
		right: 0;
		bottom: 1.173333rem;
	}
	
	.alert-img-box .p p {
		text-align: center;
		color: #fff;
		margin-bottom: .1rem;
		font-size: 0.35rem;
	}
	
	.top-tool {
		width: 100%;
		max-width: 600px;
		height: 1.76rem;
		background: #fff;
		margin: auto;
		position: fixed;
		top: 0;
		z-index: 997;
	}
	
	.top-tool .ye,
	.top-tool .lb {
		width: 100%;
		height: 1.76rem;
		display: flex;
		flex-flow: row;
		padding: 0 0.666666rem 0 0.48rem;
		align-items: center;
		justify-content: space-between;
		z-index: 2000;
	}
	
	.top-tool .lb,
	.top-tool .ye {
		position: fixed;
		top: 0;
		background: #fff;
	}
	
	.ye .my-pay-btn {
		width: 1.6rem;
		height: 0.666666rem;
		color: #fff;
		background: #00d4d2;
		border-radius: 0.08rem;
		text-align: center;
		line-height: 0.666666rem;
		font-size: 0.32rem;
	}
	
	.ye span,
	.lb span {
		font-size: 0.4rem;
	}
	
	.lb .get-money-btn {
		width: 1.6rem;
		height: 0.666666rem;
		color: #fff;
		background: #fe0154;
		border-radius: 0.08rem;
		text-align: center;
		line-height: 0.666666rem;
		font-size: 0.32rem;
	}
	
	.alert-con {
		width: 100%;
		position: absolute;
		top: -.5rem;
		bottom: 0;
		left: 0;
		right: 0;
		margin: auto;
		z-index: 1040;
	}
	
	.alert-con .alert-img-box div img {
		width: 100% !important;
	}
	
	.alert-con h3 {
		text-align: center;
	}
	
	.u-flyer {
		display: block;
		width: 50px;
		height: 50px;
		border-radius: 50px;
		position: fixed;
		z-index: 9999;
	}
	
	body {
		background: #fff !important;
	}
	
	.ql-editor {
		padding: 0 !important;
	}
	
	#phone {
		position: absolute;
		bottom: 0;
		right: 0;
		z-index: 1500;
		cursor: pointer;
		display: none;
	}
	
	#phone img {
		width: 2.5rem;
	}
	
	.close {
		position: absolute;
		top: 0;
		right: 0;
		width: 29px !important;
		height: 29px !important;
		top: -12px !important;
		right: 4px !important;
	}
	
	.tel {
		width: ;
		position: fixed;
		top: 2.45rem;
		left: 0;
		right: 0;
		margin: auto;
		width: 5.213333rem;
		height: 130px;
		background: #fff;
		border-radius: 0.066666rem;
		font-size: 0.293333rem;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #00d4d2;
		z-index: 1501;
	}
	
	.close1 {
		width: 0.4rem;
		position: absolute;
		top: -0.186666rem;
		right: -0.186666rem;
	}
	
	.lazy {
		z-index: 1000;
	}
	.mui-backdrop{
		position: absolute !important;
	}
	.rule-con-box{
		display: none;
	}
</style>
<script>
	function setFont() {

		var HTML = document.getElementsByTagName('html')[0];
		/*var dpr=1;//像素比
		var Size=document.documentElement.clientWidth*dpr/10;*/
		//把viewport视口分成10份的rem,html的font-size为1rem
		var Size = document.documentElement.clientWidth / 10;
		if(Size >= 75) {
			Size = 75
		}
		HTML.style.fontSize = Size + 'px';
		var body = document.getElementsByTagName('body')[0];
		body.style.margin = '0 auto';
		body.style.width = Size * 10 + 'px';
	};
	setFont(); //初始适配
	window.onresize = function() { //窗口大小改变适配
		setFont();
	};
</script>
<!--height: 100%;-->
<div class="container" style="max-width: 600px;  margin:0 auto ;position: relative;background: #f4f4f4 !important;">

	<div class="content">

		<div class="top-tool">
			<div class="" id="islogin" style="display: block;">
				<div class="ye" style="">
					<span id="">
						我的余额：<span style="color: #00d4d2;" id="user_earn">0LCB</span>
					</span>
					<div class="my-pay-btn">
						我的钱包
					</div>
				</div>
			</div>
			<div class="" id="nologin" style="display: none;">
				<div class="lb">
					<span id="">
						已有龙币：<span style="color: #00d4d2;" id="yylb">0LCB</span>
					</span>
					<div class="get-money-btn">
						立即领取
					</div>
				</div>
			</div>
			<div id="phone" type="tel">
				<a><img src="/resource/front/images/forward/phone_num.jpg" /></a>
			</div>
		</div>
		<div class="rule-con-box">
			<div class="rule">
				
			</div>
		</div>
			
		<div class="" style="padding: 15px; background: #f4f4f4;">
			
			<div id="top-content">
			</div>
			<div id="" class="" style="padding: .15rem .19rem;">

				<div id="bottom-content">

				</div>
				<div class="other" id="form" style="display: none;">
					<input field="name" required="true" errmsg="请输入姓名" style="margin-top: 0.213333rem; width:  45%;  padding-left: 5px;   font-size: 16px; border-color: #999; height: 0.16rem; " placeholder="姓名" type="text" class="mui-input-password" data-input-password="3">
					<input field="tel" required="true" errmsg="请输入电话" style="margin-top: 0.213333rem;  width:  45%; padding-left: 5px;border-color: #999;     font-size: 16px;height: 0.16rem;" type="number" placeholder="电话" class="mui-input-password" data-input-password="3">
					<textarea field="content" required="true" errmsg="请输入备注" style="width: 100%; height: 1.866666rem;font-size: 0.16rem;     font-size: 16px; border-color: #999; " name="" rows="" cols="" placeholder="备注"></textarea>
					<input type="button" id="submit" value="提交" style="margin-top: 19px;width: 100%;background-color: #3f81f7;border-color: #3f81f7;border-radius: 2px;">

				</div>
				<div class="haha">

				</div>
			</div>
			<div class="js_dialog" style="opacity: 1; display: none;">
				<!--<div class="weui-mask"></div>-->
			</div>
			<!--<img id="qrcode" class="longtap" src="/resource/front/images/forward/money.png" />-->
			<div class="get-money" style="opacity: 1; display: none;">
				<div class=" alert-img-box">
					<div id="">
						<img src="/resource/front/images/forward/money.png" />
					</div>
					<div class="p">
						<p>恭喜您</p>
						<p>您得到<span id="lcb"></span>个LCB奖励</p>
						<p style="margin-bottom: 0rem; font-size: 0.35rem;">快来领取吧！</p>
					</div>
				</div>
			</div>
			
			
			<div class="rule-con">
				<div class="ruleBtn">
					<img src="/resource/front/images/forward/rule.png" />
				</div>
			</div>
			<div class="telbox" style="display: none;z-index: 1501;">
				<div class="tel">
					<img class="close1" src="/resource/front/images/forward/delete.png" style="" />
					<span id="tel">
						
					</span>
				</div>
			</div>
		</div>
	</div>

</div>

{% include 'front/foot.html' %}
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/resource/front/css/mobile/jquery.fly.min.js"></script>
<!--<script type="text/javascript" src="/resource/front/css/mobile/vconsole.js"></script>-->
<script type="text/javascript" src="/resource/front/css/mobile/jquery.lazyload.min.js"></script>
<script>
	mui.ready(function() {

		mui.init({
			gestureConfig: {
				longtap: true, //默认为false
				release: true
			}
		});
		$('.content').css('min-height',document.documentElement.clientHeight);
		getLoginStatus();
		this.init();
		this.time = 0;
		this.data = "";
		this.addFeedback(); //添加留言
		this.addClick(); //添加点击数
		this.info = ""; //存放广告信息
		this.localtioncount = 0;
		this.look_time = 0;
		document.querySelector('.js_dialog').addEventListener('touchmove', function(event) {
			event.preventDefault();
		}, false);

		ykp.setLocalStorage('avinfo', window.location.search)

		$('.my-pay-btn').click(function() {
			window.location.href = 'wallte'
		})

		$('.get-money-btn').click(function() {
			window.location.href = 'login'
		})

		$('.js_dialog').click(function() {
			$('.get-money').hide();
			$('.js_dialog').hide();
		})

		$('.lb').css('width', $('.content').width() + 'px')
		$('.ye').css('width', $('.content').width() + 'px')
		ykp.getRule();  //查看规则

	})
	
	

	function initShare() {
		var that = this;
		ykp.doAjax({
			url: "/api/wxshare/wx_config",
			method: "post",
			data: {
				type: "config",
				url: window.location.href
			},
			success: function(res) {
				wx.config({
					debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
					appId: res.data.appid, // 必填，公众号的唯一标识
					timestamp: res.data.timestamp, // 必填，生成签名的时间戳
					nonceStr: res.data.nonceStr, // 必填，生成签名的随机串
					signature: res.data.signature, // 必填，签名，见附录1
					jsApiList: [
						"onMenuShareTimeline", "onMenuShareAppMessage"
					] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
				});

				wx.checkJsApi({
					jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
					success: function(res) {
						console.log(res)
						// 以键值对的形式返回，可用的api值true，不可用为false
						// 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
					}
				});
				that.wxReady(res.data.url);
			}
		})
	}
	
	
	function wxReady(url) {
		var that = this;
		wx.ready(function() {
			wx.checkJsApi({
				jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
				success: function(res) {
					//					console.log(res)
					// 以键值对的形式返回，可用的api值true，不可用为false
					// 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
				}
			});
			wx.onMenuShareTimeline({
				title: that.info.fx_name, // 分享标题
				link: url, // 分享链接
				imgUrl: that.info.fx_img, // 分享图标
				success: function(res) {
					// 用户确认分享后执行的回调函数
				},
				cancel: function() {
					// 用户取消分享后执行的回调函数
				}
			});

			wx.onMenuShareAppMessage({
				title: that.info.fx_name, // 分享标题
				link: url, // 分享链接
				desc: that.info.fx_content,
				imgUrl: that.info.fx_img, // 分享图标
				type: "",
				dataUrl: "",
				success: function(res) {
					console.log(1)
					// 用户确认分享后执行的回调函数
				},
				cancel: function() {
					// 用户取消分享后执行的回调函数
				}
			})
		})
	}

	function showCall() {
		var that = this;
		var height = window.screen.height;
		$('#phone').css('top', (height / 2) + 'px');
		window.onresize = function() { //窗口大小改变适配
			$('#phone').css('top', (height / 2) + 'px');
		};
		$('#phone').unbind('click').click(function() {
			//电脑弹框  手机打电话
			if(mui.os.ios || mui.os.android) {} else {
				$('.telbox #tel').text($('#phone a').attr('tel'))
				$('.telbox').show();
			}
			var obj = {};
			obj.type = 100; //3
			obj.key = 100; //100
			obj.money = $(this).attr('money');
			that.model_add(obj);
			that.addMoney(obj); //点击加钱
		})
		$('.close1').click(function() {
			$('.telbox').hide();
		})
	}

	function getLoginStatus() {
		var userinfo = ykp.getLocalStorage('userInfo');
		if(!userinfo) {
			$('#islogin').hide();
			$('#nologin').show();
		} else {
			$('#islogin').show();
			$('#nologin').hide();
		}

	}

	function addClick() {
		this.click("/api/Rules/click");
	}

	function addFeedback() {
		$('#submit').click(function() {
			var search = window.location.search
			search = search.replace(/\?/, "").split("=")[1];

			var data = ykp.getFormCode({
				el: "#form"
			});
			if(!data) {
				return false;
			}
			ykp.doAjax({
				url: "/api/banner/message_add",
				method: "post",
				data: {
					id: search.split(",")[1],
					name: data.name,
					content: data.content,
					tel: data.tel
				},
				success: function(res) {
					mui.toast("添加成功");
				}
			})

		})

	}

	function getScroll() {
		var that = this;
		var count = 0;
		var clientHeight = document.body.clientHeight;
		var height = window.screen.height;
		var topp = 0;
		$(window).on('scroll', function() {
			topp = $(document).scrollTop();
		})
		setInterval(function() {
			that.time = that.time + 1;
			if(height + topp > (clientHeight / 2) && !that.data) {
				if(that.time >= that.look_time && count == 0) {
					that.add_ningshi();
				}
				if(that.time >= that.look_time) { //
					count++;
					that.changeScroll();

				}

			}
		}, 1000)

		//当页面高度超过屏幕的2倍时   滚动距离+屏幕高度 大于 总高的2分之1 并且 没有添加金币的时候开启滚动跳监听
		// 反之3秒后执行添加金币
		if(height * 2 <= (height + topp)) {
			setTimeout(function() {
				that.changeScroll(); //5秒 注意力
				that.add_ningshi();
			}, that.look_time * 1000)
		}

	}

	function changeScroll() {
		var that = this;
		var search = window.location.search;
		var count = 0; //计算区域加的次数
		search = search.replace(/\?/, "").split("=")[1];
		if(that.time < 10) {
			return false;
		}
		if(that.localtioncount == 0) {
			that.localtioncount++;
			that.getLcoation();
		}

	}

	function getLcoation() {
		var that = this;
		var msg = false;

		if(this.info.promote_type == 1) { //promote_type   1定点推广 2城市推广

			var map = new AMap.Map("container1", {
				resizeEnable: true,
				center: [116.397428, 39.90923],
				zoom: 13
			});
			map.plugin('AMap.Geolocation', function() {
				var geolocation = new AMap.Geolocation({
					enableHighAccuracy: true, //是否使用高精度定位，默认:true
					timeout: 10000, //超过10秒后停止定位，默认：无穷大
					buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
					zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
					buttonPosition: 'RB'
				});
				map.addControl(geolocation);
				geolocation.getCurrentPosition();
				AMap.event.addListener(geolocation, 'complete', function(data) {
					var lnglat = new AMap.LngLat(data.position.getLng(), data.position.getLat()); //测量点
					msg = that.compareDistance(lnglat);
					if(msg) {
						if(that.time < 10) {
							return false;
						}
						$('.other5').text(6)
						that.click("/api/Rules/lcb_get");
						that.click("/api/Rules/click_get"); //添加有效点击数			

					}
				}); //返回定位信息

			});
		} else {

			//实例化城市查询类
			var citysearch = new AMap.CitySearch();
			var count = 0;

			//自动获取用户IP，返回当前城市

			citysearch.getLocalCity(function(status, result) {
				if(status === 'complete' && result.info === 'OK') {
					if(result && result.city && result.bounds) {
						var cityinfo = result.city;
						if(that.info.city_arr == "全国") {
							count = 1;
						} else {
							that.info.city_arr.forEach(function(item) {
								if(result.city == item.city) {
									count++;
								}
							})
						}

						if(count) {
							if(that.time < 10) {
								return false;
							}
							that.click("/api/Rules/lcb_get");
							that.click("/api/Rules/click_get"); //添加有效点击数		
							that.handClick();
						}
					}
				} else {

				}
			});

		}
		return msg;
	}

	//判断距离是否小于100米，是则返回true
	function compareDistance(lnglat) {
		var myDistance = parseInt(lnglat.distance([this.info.lng, this.info.lat])); //这里测量距离
		//		console.log('两点间距离为：' + myDistance + '米');
		if(myDistance < this.info.km * 1000) {
			return true;
		} else {
			return false;
		}
	}

	function click(url) {
		var that = this;
		var offset = $(".get-money-btn").offset();
		var that = this;
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		var data = {
			uid: search.split(",")[0],
			ad_id: search.split(",")[1],
			channel: search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2],
		}
		if(url == '/api/Rules/lcb_get') {
			data.my_uid = ykp.getLocalStorage('userInfo') ? JSON.parse(ykp.getLocalStorage('userInfo')).uid : 0
		}
		data.un_id = ykp.getLocalStorage('un_id');
		ykp.doAjax({
			url: url,
			method: "post",
			data: data,
			loading: true,
			success: function(res) {
				if(url == '/api/Rules/lcb_get' && res.code == 200) {
					$('.other1').text(1)
				} else if(url == '/api/Rules/lcb_get' && res.code == 400) {
					$('.other1').text(2)
				}
			}
		})
	}
	var num = 1;

	function money() {
		var flyer = $('<img class="u-flyer" src="/resource/front/images/forward/money2.png">');
		setTimeout(function() {
			flyer.fly({
				start: {
					left: $('.alert-img-box').width() - 60,
					top: $('.alert-img-box').height() + 80
				},
				end: {
					left: document.body.clientWidth - 40,
					top: 40,
					width: 0,
					height: 0
				},
				onEnd: function() {
					this.destory();
				}
			});
			if(num < 11) {
				num++;
				money();
			} else {
				$('.get-money').fadeOut(1000);
			}
		}, 100)
	}

	function init() {
		var that = this;
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		if(ykp.getLocalStorage('userInfo')) {
			if(!JSON.parse(ykp.getLocalStorage('userInfo')).uid) {
				mui.toast("登录失效，请重新登录")
				ykp.clearLocalStorage();
				setTimeout(function() {
					window.location.href = 'login';
				}, 2000);
			}
		}
		ykp.doAjax({
			url: "/api/Rules/banner_fx_detail",
			method: "post",
			data: {
				uid: search.split(",")[0],
				ad_id: search.split(",")[1],
				my_uid: ykp.getLocalStorage('userInfo') ? JSON.parse(ykp.getLocalStorage('userInfo')).uid : 0,
				is_login: ykp.getLocalStorage('userInfo') ? 1 : 2,
				channel: search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2],
				un_id: ykp.getLocalStorage('un_id') || 0
			},
			success: function(res) {
				if(res.code == 400) {
					mui.toast("登录失效，请重新登录")
					return false;
				}
				if(res.code == 300) {
					mui.toast("该广告已下架");
					$('.content').remove();
					$('.top-tool').remove();
					$('.ruleBtn').remove();
					return false;
				}
				that.look_time = res.data.look_time;

				var qd = search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2];
				//				$('.haha').text("uid:"+search.split(",")[0]+",adid:"+search.split(",")[0]+",渠道："+qd+",un_id:"+res.data.un_id)
				var content = JSON.parse(res.data.content);
				if(!ykp.getLocalStorage('un_id')) {
					ykp.setLocalStorage('un_id', res.data.un_id);
				}
				this.info = res.data;
				that.getContent(content)
				this.initShare(res.data); //初始化分享
				if(ykp.getLocalStorage('userInfo')) {
					$('#yylb').text(res.data.earn + "LCB");
					$('#user_earn').text(res.data.earn + "LCB")

				} else {
					$('#yylb').text(res.data.lcb + "LCB");
				}
				if(res.data.phoneAlert) {
					that.getAlert(JSON.parse(res.data.phoneAlert))
				}
				if(res.data.phone_number) {
					that.getCall(JSON.parse(res.data.phone_number))
				}

			}
		})
	}

	function getCall(content) {
		var that = this;
		if(content.istel) {
			$("#phone").show().attr('money', content.money).addClass('');
			//添加手机号码
			if(mui.os.ios || mui.os.android) {
				$("#phone a").attr('href', 'tel:' + content.tel);
			} else {
				$("#phone a").attr('tel', content.tel);
			}

			showCall();

		}
	}

	function getAlert(content) {
		var html = "";
		var that = this;
		if(content.hasPhoneAlert) {
			html += `
			<div class="alert-con" style="opacity: 1; ">
					<div class="alert-img-box">
						<img class="close" src="/resource/front/images/forward/delete.png" />
						<div id="" money="${content.alert_money}" class='longtap' data-type='alert' style="width: 95%; margin: auto;">
							<div ${content.alert_url_type == 0 ? '' : (content.alert_url_type == 2 ? "href=advInfo_mobile?data=11,"+content.alert_next_id+",qq" : "href="+content.alert_next_id+"")}>
								<img class="lazy" data-original="${content.alert_objUrl_base}"  />
							</div>
						</div>
					</div>
			</div>`;
			$('.js_dialog').show();
			$('.content').append(html);
			$("img.lazy").lazyload({
				effect: "fadeIn"
			});
			$('.longtap').click(function() {
				if($(this).hasClass('longtap1')) {
					return false;
				}
				$(this).addClass('longtap1');

				var obj = {};
				obj.type = $(this).attr('data-type');
				obj.key = $(this).attr('data-key');
				obj.money = $(this).attr('money');
				that.model_add(obj);

				that.addMoney(obj); //点击加钱
			})
			document.body.style.overflow = 'hidden';
			setTimeout(function() {
				$('.alert-con').remove();
				$('.js_dialog').hide();
				document.body.style.overflow = 'auto';
			}, content.alert_time * 1000)
			$('.close').click(function() {
				$('.alert-con').remove();
				$('.js_dialog').hide();
				document.body.style.overflow = 'auto';
			})
		}
	}

	function add_ningshi() {
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		var that = this;
		ykp.doAjax({
			url: "/api/Rules/add_ningshi",
			method: "post",
			data: {
				uid: search.split(",")[0], //广告用户id
				ad_id: search.split(",")[1], //广告id
				channel: search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2], //推广方式
				my_uid: ykp.getLocalStorage('userInfo') ? JSON.parse(ykp.getLocalStorage('userInfo')).uid : 0,
				is_login: ykp.getLocalStorage('userInfo') ? 1 : 2,
				un_id: ykp.getLocalStorage('un_id')
			},
			loading: true,
			success: function(res) {
				if(res.code == 200) {
					$('.get-money').fadeIn(1000);
					$('#lcb').text(that.info.look_money);
					that.money();
					$('#user_earn').text(res.data.lcb + 'LCB')
				}
				$('#yylb').text(res.data.lcb + 'LCB');
			}
		})

	}

	function handClick() {
		var that = this;
		if($('.qrcode').length > 0) {
			document.querySelector('.qrcode').addEventListener('longtap', function() {
				if($(this).hasClass('longtap1')) {
					return false;
				}
				$(this).addClass('longtap1');
				var obj = {};
				obj.type = $(this).attr('data-type');
				obj.key = $(this).attr('data-key');
				obj.money = $(this).attr('money');
				that.addFre();
				that.model_add(obj);
				that.addMoney(obj); //点击加钱

			})
		}

		$('.longtap').click(function() {
			if($(this).hasClass('longtap1')) {
				return false;
			}
			$(this).addClass('longtap1');
			var obj = {};
			obj.type = $(this).attr('data-type');
			obj.key = $(this).attr('data-key');
			obj.money = $(this).attr('money');
			obj.index = $(this).attr('data-index');
			that.model_add(obj);
			that.addMoney(obj); //点击加钱

		})

		$('#phone').click(function() {
			console.log(mui.os.ios)
		})
	}

	function addFre() {
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		ykp.doAjax({
			url: "/api/banner/banner_friend",
			method: "post",
			data: {
				ad_id: search.split(",")[1],
			},
			success: function(res) {

			}
		})
	}

	function addMoney(obj) {
		var that = this;
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		ykp.doAjax({
			url: "/api/Rules/tz_lcb_add",
			method: "post",
			data: {
				key: obj.key,
				uid: search.split(",")[0],
				ad_id: search.split(",")[1],
				channel: search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2],
				un_id: ykp.getLocalStorage('un_id'),
				type: obj.type == 'alert' ? 2 : (obj.type == 100 ? 100 : 1)
			},
			loading: true,
			success: function(res) {
				//当为单图 和弹窗时 跳转页面
				if(obj.type == 'alert') {
					if(that.info.alert_url_type != 0) {
						if(JSON.parse(that.info.phoneAlert).alert_url_type == 2) {
							window.location.href = "advInfo_mobile?data=11," + JSON.parse(that.info.phoneAlert).alert_next_id + ",qq";
						} else {
							window.location.href = JSON.parse(that.info.phoneAlert).alert_next_id;
						}
					}
				} else if(obj.type == '0') {
					var type = JSON.parse(that.info.content)[obj.index].url_type;
					if(type == 1) {
						window.location.href = JSON.parse(that.info.content)[obj.index].href;
					} else if(type == 2) {
						window.location.href = "advInfo_mobile?data=" + search.split(",")[0] + "," + JSON.parse(that.info.content)[obj.index].href + "," + search.split(",")[2] + "";
					}
				}
			}
		})
	}

	function model_add(obj) {
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		ykp.doAjax({
			url: "/api/banner/model_add",
			method: "post",
			data: {
				key: obj.key,
				ad_id: search.split(",")[1],
				channel: search.split(",")[2].indexOf('&') != -1 ? search.split(",")[2].slice(0, search.split(",")[2].indexOf('&')) : search.split(",")[2],
				type: obj.type,
			},
			loading: true,
			success: function(res) {}
		})
	}

	function getContent(content) {
		console.log(content)
		var that = this;
		var html = "";
		var ly = ""; // 留言
		var search = window.location.search
		search = search.replace(/\?/, "").split("=")[1];
		for(var i in content) {
			if(content[i].type == 0) { //单图
				//+ (content[i].url_type != 0 ? "href='" + (content[i].url_type == 1 ? content[i].href : 'advInfo?data=' + search.split(",")[0] + ',' + content[i].href)  : '') +
				html += "<a class='longtap' " + (content[i].url_type != 0 ? (content[i].url_type == 1 ? "href='" + content[i].href : 'href=advInfo?data=' + content[i].href) : '') + "'><img class='lazy' data-original='" + content[i].img_base + "'/></a>";
			} else if(content[i].type == 1) { //标题
				html += `<div  class=" ${content[i].style == 0 ? 'left' : 'right'}" >${content[i].title}</div>`;
			} else if(content[i].type == 2) { //富文本
				html += "<div class='ql-snow'  data-key=" + content[i].key + " style='font-size: 12px;'><div  money=" + content[i].money + " style='white-space: pre-wrap' class='longtap richText ql-editor' id='texttrea" + i + "' data-key='" + content[i].key + "'  data-type='" + content[i].type + "'>" + content[i].richText + "</div></div>";
			} else if(content[i].type == 3) { //辅助空白
				var div = "<div  style='" + getStyle(content[i].spaceColor) + "'></div>"
				html += div;
			}
			//			else if(content[i].type == 5) { //电话
			//				html += `<div class='longtap' money="${content[i].money}" data-key="${content[i].key}"  data-type="${content[i].type}" id=""><p style="width: 100%;height:0.426666rem;line-height: 0.426666rem;margin-top:0.426666rem; margin-bottom: 10px;">拨打下方电话</p>
			//			<div class="" style="height: 0.426666rem;line-height: 0.426666rem; display: flex;align-items: center;">
			//				<a class="tel" style="display: inline-block;margin-left: 0.28rem;" href="tel://${content[i].tel}" tel='${content[i].tel}'>
			//					${content[i].tel}  
			//				</a>
			//				<img class="tel" src="/resource/front/images/forward/call.png" style="width:  0.3rem; height: 0.3rem;margin-left: .11rem;"/>
			//			</div>
			//			
			//		</div>`;
			//			} 
			else if(content[i].type == 6) { //留信息
				ly += `<div id="ly" money="${content[i].money}" class='longtap' data-type="${content[i].type}" data-key="${content[i].key}">
				<p style="margin-top: .07rem;word-break: break-all; ${getStyle(content[i].fontSize1)}" >${content[i].title}</p>
				<p style="margin-top:.11rem; ${getStyle(content[i].fontSize2)}">${content[i].info}</p>
			</div>`;
			} else if(content[i].type == 7) {
				html += '<img class="longtap qrcode lazy" money=' + content[i].money + ' id="qrcode" data-key="' + content[i].key + '" data-type="' + content[i].type + '" style="width:100%;" data-original="' + content[i].img_base + '" />'
			}
		}

		$("#top-content").html(html);
		$("#bottom-content").html(ly);
		$("#top-content img").lazyload({
			effect: "fadeIn"
		});
		if(ly) {
			$('#form').show();
		}
		setTimeout(function() {
			this.getScroll(); //添加加币规则
		}, 100)
		that.handClick();

	}

	function getStyle(obj) {
		var style = "";
		for(var i in obj) {
			style += (i + ":" + obj[i] + ";");
		}
		return style;
	}
</script>